package com.base.service.system.service;

import java.util.List;

import com.base.core.framework.sql.service.SqlBaseServiceStreamV1Ext;
import com.base.core.head.constants.CodeResVal;
import com.base.service.system.ao.UserAO;
import com.base.service.system.ao.UserLoginAO;
import com.base.service.system.ao.UserPwdAO;
import com.base.service.system.entity.UserDO;
import com.base.service.system.vo.AuthVO;
import com.base.service.system.vo.UserLoginVO;
import com.base.service.system.vo.UserVO;
import com.gitee.magic.framework.head.utils.Assert;

/**
 * @author start
 */
public interface UserService extends SqlBaseServiceStreamV1Ext<UserDO,UserVO> {
    
	/**
	 * 登录
	 * @param ao
	 * @param requestIp
	 * @return
	 */
	UserLoginVO login(UserLoginAO ao, String requestIp);
    /**
     * 授权权限
     * @param parentId
     * @param userId
     * @return
     */
    List<AuthVO> userAuthTree(Long parentId,Long userId);

    /**
     * 检测用户名是否已存在
     * @param userName
     */
    void checkUserNameExist(String userName);
	
	/**
	 * 保存
	 * @param ao
	 */
    void save(UserAO ao);

    /**
     * 设置密码
     * @param ao
     * @param userId
     */
    void setPassword(UserPwdAO ao,Long userId);
    
    /**
     * 重置谷歌验证器
     * @param userId
     * @return
     */
    String restMfa(Long userId);

    /**
     * 检测
     * @param user 用户对象
     */
    default void checkUserNotDisable(UserDO user) {
        Assert.isNull(user, CodeResVal.CODE_10017);
        Assert.isTrue(user.getDisable(), CodeResVal.CODE_10014);
    }
    
}
